package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-07-27
 * Time: 14:59
 */
class SingletonLazy {
    private static volatile SingletonLazy instance = null;
    private static Object locker = new Object();
    public static SingletonLazy getInstance() {
        if(instance == null) {
            synchronized (SingletonLazy.class) {
                if(instance == null) {
                    instance = new SingletonLazy();
                }
                return instance;
            }
        }
        return instance;
    }
    private SingletonLazy() {}
}
public class Demo17 {
    public static void main(String[] args) {

    }
}
